<!DOCTYPE html>
<html>
<head>
    <meta name="layout" content="main"/>
    <g:set var="entityName" value="${message(code: 'contact.label', default: 'Contact')}"/>
    <title>新增信用</title>
</head>

<body>
<div class="small-header">
    <div class="hpanel">
        <div class="panel-body">
            <div id="hbreadcrumb" class="pull-right">
                <ol class="hbreadcrumb breadcrumb">
                    <li>PLS CINDATA</li>
                    <li>
                        <g:link controller="menu" action="index">CINDATA</g:link>
                    </li>
                    <li class="active">
                        <span>新增主借款人</span>
                    </li>
                </ol>
            </div>

            <h2 class="font-light m-b-xs">
                新增主借款人
            </h2>
        </div>
    </div>
</div>

<g:form action="save">
    <g:if test="${flash.message}">
        <div class="message alert alert-info" role="status">${flash.message}</div>
    </g:if>
    <g:hasErrors bean="${this.menu}">
        <ul class="errors" role="alert">
            <g:eachError bean="${this.menu}" var="error">
                <li <g:if test="${error in org.springframework.validation.FieldError}">data-field-id="${error.field}"</g:if>><g:message
                        error="${error}"/></li>
            </g:eachError>
        </ul>
    </g:hasErrors>

    <div class="content animate-panel">
        <div class="row">
            <div class="hpanel hred">
                <div class="panel-heading">
                    关联贷款信息
                </div>
                <div class="panel-body form-horizontal">
                    <div class="form-group">
                        <label class="col-md-2 control-label is-required">贷款</label>
                        <div class="col-md-3">
                            <g:select class="form-control m-b" multiple="multiple" name="mortgageList" id="mortgageList" from="${com.cindata.Mortgage.list(max: 1000)}" optionValue="serialNumber" optionKey="id" value="${this?.vehicle?.mortgage?.id}" noSelection="${['': '请选择贷款']}"/>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="content animate-panel">
        <div class="row">
            <div class="hpanel hblue">
                <div class="panel-heading">
                    主借款人基本信息
                </div>

                <div class="panel-body form-horizontal">

                    <div class="form-group">
                        <label class="col-md-2 control-label is-required">类型</label>
                        <div class="col-md-3">
                            <g:select class="form-control m-b" name="contactType" id="contactType" from="${com.cindata.dictionary.ContactType.list()}" optionKey="id" optionValue="name" value="${this.contact?.type}" noSelection="${['': '请选择类型']}"/>
                        </div>
                        <label class="col-md-2 control-label is-required">姓名</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="fullName" id="fullName" value="${this.contact?.fullName}"/>
                        </div>
                    </div>
                    
                    <div class="form-group ">

                        <label class="col-md-2 control-label is-required">联系电话</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="cellphone" id="cellphone" value="${this.contact?.cellphone}"/>
                        </div>

                        <label class="col-md-2 control-label is-required">性别</label>
                        <div class="col-md-3">
                            <g:select class="form-control m-b" name="sex" id="sex"
                                      from="${['男','女']}"
                                      value="${this.contact?.sex}"
                                      noSelection="${['': '请选择性别']}"/>
                        </div>
                    </div>

                    <div class="form-group ">
                        <label class="col-md-2 control-label">出身年月日</label>
                        <div class="col-md-3">
                            <g:datePicker class="form-control" name="birthday" value="${new Date()}" precision="day"/>
                        </div>
                        <label class="col-md-2 control-label is-required">学历</label>
                        <div class="col-md-3">
                            <g:select class="form-control m-b" name="degree" id="degree"
                                      from="${["小学", "初中", "高中", "大专","本科", "硕士研究生","博士研究生"]}"
                                      value="${this.contact?.degree}"
                                      noSelection="${['': '请选择学历']}"/>
                        </div>
                    </div>

                    <div class="form-group ">
                        <label class="col-md-2 control-label is-required">户口所在地</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="householdAddress" id="householdAddress" value="${this.contact?.householdAddress}"/>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label is-required">户口类型</label>
                            <div class="col-sm-3" >
                                <g:select class="form-control" name="accountNature" id="accountNature"
                                          optionKey="id" optionValue="name"
                                          from="${com.cindata.dictionary.AccountNatureDict.list()}"
                                          value="${this.contact?.accountNature}"
                                          noSelection="${['': '请选择户口类型']}"/>
                            </div>
                        </div>
                    </div>


                    <div class="form-group ">

                            <label class="col-md-2 control-label is-required">户口性质</label>
                            <div class="col-sm-3" >
                                <g:select class="form-control" name="householdType" id="householdType"
                                          from="${['农业户口','非农业户口']}"
                                          value="${params?.householdType}"
                                          noSelection="${['': '请选择户口性质']}"/>
                            </div>

                        <label class="col-md-2 control-label is-required">地址</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="address" id="address" value="${this.contact?.address}"/>
                        </div>
                    </div>

                    <div class="form-group ">
                        <label class="col-md-2 control-label is-required">证件类型</label>
                        <div class="col-md-3" >
                            <g:select class="form-control" name="identityType" id="identityType"
                                      optionKey="id" optionValue="name"
                                      from="${com.cindata.dictionary.ContactIdentityType.list()}"
                                      value="${this.contact?.identityType}"
                                      noSelection="${['': '请选择证件类型']}"/>
                        </div>
                        <label class="col-md-2 control-label is-required">证件号</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="idNumber" id="idNumber" value="${this.contact?.idNumber}"/>
                        </div>
                    </div>
                    <div class="form-group ">
                        <label class="col-md-2 control-label is-required">婚姻状态</label>
                        <div class="col-md-3">
                            <g:select class="form-control m-b" name="maritalStatus" id="maritalStatus"
                                      from="${["未婚", "已婚", "再婚", "离异", "丧偶"]}"
                                      value="${this.contact?.maritalStatus}"
                                      noSelection="${['': '请选择婚姻状态']}"/>
                        </div>
                        <label class="col-md-2 control-label is-required">工作单位性质</label>
                        <div class="col-sm-3">
                            <g:select class="form-control" name="workUnitNature" id="workUnitNature"
                                      optionKey="id" optionValue="name"
                                      from="${com.cindata.dictionary.OrganizationNatureDict.list()}"
                                      value="${this.contact?.workUnitNature}"
                                      noSelection="${['': '请选择工作单位性质']}"/>
                        </div>
                    </div>

                    <div class="form-group ">
                        <label class="col-md-2 control-label is-required">工作单位名称</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="workUnitName" id="workUnitName" value="${this.contact?.workUnitName}"/>
                        </div>
                        <label class="col-md-2 control-label is-required">职务</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="position" id="position" value="${this.contact?.position}"/>
                        </div>
                    </div>

                    <div class="form-group ">
                        <label class="col-md-2 control-label is-required">当前缴存状态</label>
                        <div class="col-sm-3">
                            <g:select class="form-control" name="depositedState" id="depositedState"
                                      optionKey="id" optionValue="name"
                                      from="${com.cindata.dictionary.DepositedStateDict.list()}"
                                      value="${this.contact?.depositedState}"
                                      noSelection="${['': '请选择当前缴存状态']}"/>
                        </div>
                        <label class="col-md-2 control-label is-required">家庭已购房套数</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="ownHouseCount" id="ownHouseCount" value="${this.contact?.ownHouseCount}"/>
                        </div>
                    </div>

                    <div class="form-group ">
                        <label class="col-md-2 control-label is-required">贷款时月缴存基数（元）</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="depositBaseOnLoans" id="depositBaseOnLoans" value="${this.contact?.depositBaseOnLoans}"/>
                        </div>
                        <label class="col-md-2 control-label is-required">贷款时月缴存额（元）</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="depositAmountOnLoans" id="depositAmountOnLoans" value="${this.contact?.depositAmountOnLoans}"/>
                        </div>
                    </div>

                    <div class="form-group ">
                        <label class="col-md-2 control-label is-required">当前月缴存基数（元）</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="depositBaseOnCurrent" id="depositBaseOnCurrent" value="${this.contact?.depositBaseOnCurrent}"/>
                        </div>

                        <label class="col-md-2 control-label is-required">当前月缴存额（元）</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="depositAmountOnCurrent" id="depositAmountOnCurrent" value="${this.contact?.depositAmountOnCurrent}"/>
                        </div>
                    </div>

                    <div class="form-group ">
                        <label class="col-md-2 control-label is-required">贷款时家庭月收入（元）</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="fmiOnLoans" id="fmiOnLoans" value="${this.contact?.fmiOnLoans}"/>
                        </div>
                        <label class="col-md-2 control-label is-required">公积金账号</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="publicFundAccount" id="publicFundAccount" value="${this.contact?.publicFundAccount}"/>
                        </div>

                    </div>

                    <div class="form-group ">

                        <label class="col-md-2 control-label is-required">信用等级</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="creditLevel" id="creditLevel" value="${this.contact?.creditLevel}"/>
                        </div>
                        <label class="col-md-2 control-label is-required">信用额度</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="creditAmount" id="creditAmount" value="${this.contact?.creditAmount}"/>
                        </div>
                    </div>

                    <div class="form-group ">
                        <label class="col-md-2 control-label is-required">职称</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="title" id="title" value="${this.contact?.title}"/>
                        </div>

                        <label class="col-md-2 control-label is-required">信用余额</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="creditBalance" id="creditBalance" value="${this.contact?.creditBalance}"/>
                        </div>
                    </div>
                <div class="form-group">
                    <div class="col-md-3 col-md-offset-6">
                        <g:submitButton class="btn btn-info" name="create" value="保存"/>
                    </div>
                </div>
</g:form>

<g:javascript>
    $(function () {
        $('.datepicker').datepicker({
            language: 'zh-CN',
            format:"yyyy-mm-dd"
        });
        $('.input-group.date').datepicker({ });
        $('.input-daterange').datepicker({ });
    });
</g:javascript>
</body>
</html>
